﻿using System;
using Transformable_Engine_v2.Engine;
using Transformable_Engine_v2.Engine.Graphics;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Project_Maverick.Content.Images.Background
{
    public class SpriteSheetBackground : SpriteSheetInstance
    {
        private static SpriteSheetInstance _instance;
        public static void LoadContent()
        {
            _instance = new SpriteSheetBackground();
        }
        public new static Sprite GetSprite(Enum textureName)
        {
            return _instance.GetSprite(textureName);
        }
        public static SpriteSheetInstance GetInstance()
        {
            return _instance;
        }
        public static Sprite GetSprite(string text)
        {
            Alphabet value;
            if (Enum.TryParse(text, out value))
            {
                return GetSprite(value);
            }

            return null;
        }

        public enum Common
        {
            BackgroundTriangles,
            BackgroundAlternateTriangles,
            TitleImage,
            TitleTriangles,
            TitleAlternateTriangles,
        }

        public enum StitchBackground
        {
            TopLeft,
            TopMiddle,
            TopRight,
            CenterLeft,
            CenterMiddle,
            CenterRight,
            BottomLeft,
            BottomMiddle,
            BottomRight,
        }

        public enum Alphabet
        {
            A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
            Num0, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, 
            Unknown,
        }

        public override string SpriteSheetPath
        {
            get
            {
                return "Content/Images/Background/Background.png";
            }
        }

        protected override void LoadSprites()
        {
            AddEnumList<Common>(Common.BackgroundTriangles, Common.BackgroundAlternateTriangles, new TE_Rectangle(0, 0, 27f/Game.Options.GridSize, 27));
            AddSprite(Common.TitleImage, new TE_Rectangle(0, 27, 48, 6));
            AddEnumList<Common>(Common.TitleTriangles, Common.TitleAlternateTriangles, new TE_Rectangle(48, 27, 27f / Game.Options.GridSize, 6));

            AddEnumList<StitchBackground>(StitchBackground.TopLeft, StitchBackground.BottomRight, new TE_Rectangle(48, 0, 6, 6), 3);

            AddEnumList<Alphabet>(Alphabet.A, Alphabet.Unknown, new TE_Rectangle(0, 33, 1, 1.25f), 10);
        }

        
    }
}